package ink.zhaohui;


import java.util.concurrent.atomic.AtomicLong;

public class IdGenerator {
  private AtomicLong id = new AtomicLong(0);
  private IdGenerator() {System.out.println("IdGenerator");}

  private static class SingletonHolder{
    private static final IdGenerator instance = new IdGenerator();
  }

  public static IdGenerator getInstance() {
    return SingletonHolder.instance;
  }

  public long getId() {
    return id.incrementAndGet();
  }
  public static void  main(String[] args){
    IdGenerator id=IdGenerator.getInstance();
    System.out.println("return");
  }
}
